//
//  NSVipFuncItemView.m
//  Meboo
//
//  Created by kyo on 2024/1/5.
//

#import "NSVipFuncItemView.h"
//#import "TTTAttributedLabel.h"
@interface NSVipFuncItemView()
@property(nonatomic,strong) UIImageView *iconImageView;
@property(nonatomic,strong) UILabel *titleLab;
@property(nonatomic,strong) UILabel *subTitleLab;
@end

@implementation NSVipFuncItemView
#pragma mark - Life Cycle
- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        [self setupUI];
    }
    return self;
}

#pragma mark - Public Metohd
- (void)setModel:(MBVipEquityModel *)model {
    _model = model;
    self.titleLab.text = model.tip;
    self.subTitleLab.text = model.content;
    [self.iconImageView sd_setImageWithURL:[NSURL URLWithString:model.icon]];
    
}
#pragma mark - Action

#pragma mark - UI
- (void)setupUI {
    self.backgroundColor = UIColor.clearColor;
    
    [self addSubview:self.iconImageView];
    [self.iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self);
        make.left.mas_equalTo(MBWidthScale(17));
        make.height.width.mas_equalTo(MBHeightScale(49));
    }];
    
    [self addSubview:self.titleLab];
    [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.mas_centerY).offset(MBHeightScale(-3));
        make.left.equalTo(self.iconImageView.mas_right).offset(MBWidthScale(25));
        make.right.mas_equalTo(MBWidthScale(-10));
    }];
    
    [self addSubview:self.subTitleLab];
    [self.subTitleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.mas_centerY).offset(MBHeightScale(3));
        make.left.equalTo(self.iconImageView.mas_right).offset(MBWidthScale(25));
        make.right.mas_equalTo(MBWidthScale(-10));
    }];
}

#pragma mark - Setter && Getter
- (UIImageView *)iconImageView {
    if (!_iconImageView) {
        _iconImageView = [UIImageView new];
        _iconImageView.image = ImageWithName(@"flower_defult");
    }
    return _iconImageView;
}


- (UILabel *)titleLab {
    if (!_titleLab) {
        _titleLab = [UILabel new];
        _titleLab.font = MBHelBoldFontSizeScale(14);
//        _titleLab.textColor = HEXS(@"391FD3");
        _titleLab.textColor = [[UIColor alloc] initWithPatternImage:ImageWithName(@"vip_purchase_back_nocorner")];
    }
    return _titleLab;
}

- (UILabel *)subTitleLab {
    if (!_subTitleLab) {
        _subTitleLab = [UILabel new];
        _subTitleLab.numberOfLines = 2;
        _subTitleLab.font = MBHelFontSizeScale(13);
        _subTitleLab.textColor = HEXS(@"666666");
    }
    return _subTitleLab;
}
@end
